import axiosBase from "../axiosBase";
import {userUrl} from "../urls";
import md5 from "js-md5";
// 密码登录
function passLogin(data){
    console.log(md5("123"));
    data.loginType = "pass";
    data.time = Math.round(new Date().getTime()/1000);
    data.userpassword = md5(md5(md5(data.userpassword+"id&*4(jdj*^%fj").toLocaleUpperCase()
                            +"t0^&^d94wrdfhjrk36f1encn243d#@@?,jdsfj").toLocaleUpperCase()
                            +",.4h8&%348()3232" + data.time).toLocaleUpperCase();
    return axiosBase.post(userUrl.passLogin,data);
}
// 发送验证码
function sendSmsCode(data){
    return axiosBase.get(userUrl.sendSmsCode,data).then((res)=>{
        console.log(res);
    });
}

// 获取用户信息/检查用户登录是否过期
function checkLogin(){
    return axiosBase.get(userUrl.resetPer);
}

export default {
    passLogin,
    sendSmsCode,
    checkLogin
}